import Vue from 'vue'
import Vuex from 'vuex'
import axios from '../utils/mtAxios'
import apis from '../apis'
Vue.use(Vuex)

export default new Vuex.Store({
  state: {
	  allRolles:[],
	  permissions:[]
  },
  mutations: {
	  LOADALLROLES(state,payload){
		  state.allRolles = payload.data
	  },
	  LOADALLPERMISSIONS(state,payload){
		  state.permissions = payload.data
	  }
  },
  actions: {
	 async loadAllrole({commit},payload){
		var rs = await axios.get(apis.findRole);
		commit('LOADALLROLES',rs.data)
	  },
	  async loadAllPermission({commit},payload){
		var re = await axios.post(apis.findPermissions)
		commit('LOADALLPERMISSIONS',re.data)
	  },
  },
  
  modules: {
  }
})
